<!--
  * @Description: 页面入口-加载页
  * @Author: rcc
  * @Date: 2024-08-15 13:40:45
  * @FilePath: /rc-recruitment/pages/index/index.vue
-->

<template>
  <view>
    <up-loading-page
      loading
      iconSize="56rpx"
      fontSize="32rpx"
      color="#999" />
  </view>
</template>

<script lang="ts" setup>
  import { onLoad } from '@dcloudio/uni-app'

  import { useUserStore } from '@/stores/user.ts'

  const userStore = useUserStore()

  onLoad(() => {
    redirectPage()
  })

  const redirectPage = async () => {
    const isLogin = await userStore.checkToken()

    if (isLogin) {
      uni.switchTab({ url: '/pages/tab-page/tab-1/tab-1' })
    } else {
      uni.redirectTo({ url: '/pages/user/role/role' })
    }
  }
</script>

<style lang="scss" scoped></style>
